(function($) {
	$.fn.baiduPlayer = function(options){
		var defaults = {
				//播放器高度
				height:495,
				//播放器宽度
				width:720,
				//当前播放源地址
				url:"",
				//是否自动播放。
				autoPlay:"true",
				//上一集页面地址
				lastWebPage:"",
				//下一集页面地址
				nextWebPage:"",
				//下一集缓冲播放源地址
				nextCacheUrl:""
		};
		/*参数的转换begin*/
		var options = $.extend(defaults, options);
		if(options.autoPlay == "true"){ options.autoPlay = "1"; }else{options.autoPlay = "0";}
		return this.each(function(){
			//判断浏览器类型
			var player;
			if($.browser.msie)
			{
				player='<object classid="clsid:02E2D748-67F8-48B4-8AB4-0A085374BB99" width="'+options.width+'" height="'+options.height+'" id="BaiduPlayer" name="BaiduPlayer" onerror="showInstall();" >';
				player+='<param name="URL" value="'+options.url+'">';
				player+='<param name="LastWebPage" value="'+options.lastWebPage+'">';
				player+='<param name="NextWebPage" value="'+options.nextWebPage+'">';
				player+='<param name="NextCacheUrl" value="'+options.nextCacheUrl+'">';
				player+='<param name="Autoplay" value="'+options.autoPlay+'">';
				player+='</object>';
			}
			else
			{
				player='<object id="BaiduPlayer" name="BaiduPlayer" type="application/player-activex" width="'+options.width+'" height="'+options.height+'" progid="Xbdyy.PlayCtrl.1" param_URL="'+options.url+'" param_NextCacheUrl="'+options.nextCacheUrl+'" param_LastWebPage="'+options.lastWebPage+'" param_NextWebPage="'+options.nextWebPage+'" param_OnPlay="onPlay" param_OnPause="onPause" param_OnFirstBufferingStart="onFirstBufferingStart" param_OnFirstBufferingEnd="onFirstBufferingEnd" param_OnPlayBufferingStart="onPlayBufferingStart" param_OnPlayBufferingEnd="onPlayBufferingEnd" param_OnComplete="onComplete" param_Autoplay="'+options.autoPlay+'"></object>';
			}
			$(this).html(player);
		});
		function showInstall()
		{
			
		};
	};
	
})(jQuery);
